package rest_api

import (
	"scheduler/dal"
	pkgJob "scheduler/job"

	"gopkg.in/gin-gonic/gin.v1"
)

var _jobHandler = &jobHandler{}

type jobHandler struct {
}

func (*jobHandler) Create(c *gin.Context) {
	var job Job
	err := RetrieveHTTPBody(c.Request.Body, &job)
	if nil != err {
		c.AbortWithError(400, err)
	}

	var job2 dal.Job
	j, err := dal.JobModel().Insert(&job2)
	if nil != err {
		c.AbortWithError(500, err)
	}
	pkgJob.AddJob(j.ID)
}

func (*jobHandler) Read(c *gin.Context) {

}

func (*jobHandler) Update(c *gin.Context) {

}

func (*jobHandler) Delete(c *gin.Context) {

}
